#ifndef __MYMISC_H__
#define __MYMISC_H__

void NVIC_Config(void);
void systick_init(u16 t);
//void delay_us(u32 us) ;
//void delay_ms(u32 ms) ;
void blockdelay_ms(u32 t);
void sys_param_init(void);
void soft_reset(void);
void ModulePowerCtrlInit(void);


#define sleep(x) blockdelay_ms(x)
#define GPRS_ON()  do{ \
											GPIOD->ODR |= (1 << 3); \
											sleep(500);\
											GPIOD->ODR &= ~(1 << 3);\
											sleep(1000);\
										}while(0);

#define GPRS_OFF()  do{ \
											GPIOD->ODR |= (1 << 2); \
											sleep(500);\
											GPIOD->ODR &= ~(1 << 2);\
											sleep(2000);\
										}while(0);

	
										
										
#define GPS_ON() do{ \
											GPIOD->ODR |= (1 << 7); \
											sleep(500);\
											GPIOD->ODR &= ~(1 << 7);\
										}while(0);

#define GPS_OFF() do{ \
											GPIOD->ODR |= (1 << 6); \
											sleep(500);\
											GPIOD->ODR &= ~(1 << 6);\
										}while(0);

#define AD_amplify_adjust(x)  do { \
	                                 if((x-1) & sbit(0))  GPIOC->ODR |= (1 << 1);\
																	 else GPIOC->ODR &= ~(1 << 1); \
	                                 if((x-1) & sbit(1))  GPIOC->ODR |= (1 << 2);\
																	 else GPIOC->ODR &= ~(1 << 2); \
																	}while(0)

#endif



